#include<bits/stdc++.h>
//#define int long long
#define re register
#define rep(i,a,b) for(int i(a);i<=(b);++i)
#define req(i,a,b) for(int i(a);i>=(b);--i)
using namespace std;
#ifdef ONLINE_JUDGE
char buf[(1<<21)+5],*p1,*p2;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
#endif
template<typename T> inline int read(T &num){
	int f=0,x=0;
	char ch=getchar();
	while(!isdigit(ch)){f|=(ch=='-');ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return num=f?-x:x;
}
inline int Read()
{
	re int x=0,f=0;re char ch=getchar();
	while(!isdigit(ch)) f|=ch=='-',ch=getchar();
	while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
template<typename T> inline void write(T num)
{
	num=num<0?putchar('-'),-num:num;
	num>9?write(num/10),0:0;
	putchar(num%10+48);
}
template<typename T> inline void writeln(T num)
{
	write(num);
	putchar('\n');
}
///////////////////////////////////////////////////////////////
int n,x,y,fa[1000001],vis[1000001],X[1000001],Y[1000001];
set<int> s; 
vector<int> graph[1000001];
int ans[1000001],top;
void output()
{
	rep(i,1,top) write(ans[i]),putchar(32);
}
void dfs(int x)
{
//	cerr<<x<<" in\n";
	ans[++top]=x;
	if(top==n) output(),exit(0);
	if(vis[x]!=1) return;
	s.erase(fa[x]);
	int more=*prev(s.end()),minx=0x7fffffff;
//	cerr<<"now max="<<more<<'\n';
	vis[x]=2,s.insert(x);
	int had=0;
	for(int i:graph[x])
	{
		if(i!=fa[x]) vis[i]=1;
	}
	rep(i,1,n) if(i>more&&vis[i]==1) had=1;
	if(!had)
	{
		vis[x]=1,s.erase(x),s.insert(fa[x]),--top;
		for(int i:graph[x])
		{
			if(i!=fa[x]) vis[i]=0;
		}
//		cerr<<x<<" didn't have, out\n";
//		cerr<<graph[x].size()<<'\n';
		return;
	}
	rep(i,1,n) if(i>more&&vis[i]==1) dfs(i);
	vis[x]=1,s.erase(x),s.insert(fa[x]),--top;
//	cerr<<x<<" out\n";
}
bool isline()
{
	rep(i,2,n-1) if(X[i]!=Y[i-1]) return 0;
	return 1;
}
signed main()
{
	freopen("choice.in","r",stdin);
	freopen("choice.out","w",stdout);
	read(n);
	for(re int i=1;i^n;++i)read(X[i]),read(Y[i]),graph[X[i]].emplace_back(Y[i]),graph[Y[i]].emplace_back(X[i]),fa[y]=x;
	if(isline())
	{
		write(X[1]);putchar(' ');
		rep(i,1,n-1) write(Y[i]),putchar(' ');
	}
	vis[1]=1;
	s.insert(-1);
	dfs(1);
	output();
	return 0;
}

